<template>
  <div>
    sdsdsssssssssssssssss
    <!-- <div>
      <video id="LocalVideo" autoplay muted></video>
    </div> -->
    <div>
      <video  controls autoplay></video>
    </div>
    <!-- <remote-js src="https://cdn.scaledrone.com/scaledrone.min.js"> </remote-js> -->
  </div>
</template>


<script>
export default {
  data() {
    return {
      lv: null,
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.lv = document.querySelector("video");
      const contrains = {
        video: true,
        audio: true,
      };
      let that = this;
      navigator.mediaDevices.getUserMedia(contrains).then(function (stream) {
        console.log(stream)
        console.log(that.lv)
        if ('srcObject' in that.lv) {
          that.lv.srcObject = stream;
        } else {
          // 防止在新的浏览器里使用它，应为它已经不再支持了
          that.lv.src = window.URL.createObjectURL(stream);
        }
          // that.lv.srcObject = stream;
      });
      console.log();
    },
    gotLocalStream(mediaStream) {
      console.log(this.mediaStream);
      this.lv.srcObject = mediaStream;
    },
  },
};
// Generate random room name if needed
// console.log( window.rId)
// if (!location.hash) {
//   location.hash =  window.rId
//   console.log("------------")
//   console.log( window.rId)
//   console.log(location.hash)
//   console.log("------------")
// }
</script>

<style>
/* video {
  /* max-width: calc(40% - 100px); */
/* margin: 0 20px;
  box-sizing: border-box;
  border-radius: 2px;
  padding: 0;
  box-shadow: rgba(156, 172, 172, 0.2) 0px 2px 2px,
    rgba(156, 172, 172, 0.2) 0px 4px 4px, rgba(156, 172, 172, 0.2) 0px 8px 8px,
    rgba(156, 172, 172, 0.2) 0px 16px 16px,
    rgba(156, 172, 172, 0.2) 0px 32px 32px,
    rgba(156, 172, 172, 0.2) 0px 64px 64px;
} */
</style>